#!/usr/env/php
<?php
/**
 * only run a controller.
 */

use Inhere\Console\Examples\Controller\HomeController;

define('BASE_PATH', dirname(__DIR__));

require dirname(__DIR__) . '/test/boot.php';

$input = new \Inhere\Console\IO\Input();
$ctrl  = new HomeController($input, new \Inhere\Console\IO\Output());
$ctrl->setExecutionAlone();

try {
    exit($ctrl->run($input->getCommand()));
} catch (\Exception $e) {
    $message = \Toolkit\Cli\Color::apply('error', $e->getMessage());

    echo \sprintf("%s\nFile %s:%d\nTrace:\n%s\n",
        $message, $e->getFile(), $e->getLine(), $e->getTraceAsString()
    );
}

// can also: see './alone-app' file
